var SingleGridEject={
	getView:function(e){
		if(typeof (e)=="object"){
			this.scope=e.scope;
			if("undefined"==typeof e.callback)e.callback="";
			this.callback=e.callback;
			if("undefined"==typeof e.winId)e.winId="";
			this.winId=e.winId;
			if("undefined"==typeof e.winTitle)e.winTitle="";
			this.winTitle=e.winTitle;
			if("undefined"==typeof e.winWidth)e.winWidth="";
			this.winWidth=e.winWidth;
			if("undefined"==typeof e.winHeight)e.winHeight="";
			this.winHeight=e.winHeight;
			if("undefined"==typeof e.winListurl)e.winListurl="";
			this.winListurl=e.winListurl;
			if("undefined"==typeof e.winFields)e.winFields="";
			this.winFields=e.winFields;
			if("undefined"==typeof e.columnModel)e.columnModel="";
			this.columnModel=e.columnModel;
			if("undefined"==typeof e.inputFormId)e.inputFormId="";
			this.inputFormId=e.inputFormId;
			if("undefined"== typeof e.select) e.select=false;//判断是不是选择框
			this.select=e.select;
		}else{
		    this.scope=this;
		    if("undefined"==typeof callback)callback="";
		    this.callback=e;
		    if("undefined"==typeof winId)winId="";
		    this.winId=winId;
		    if("undefined"==typeof winTitle)winTitle="";
		    this.winTitle=winTitle;
		    if("undefined"==typeof winWidth)winWidth="";
		    this.winWidth=winWidth;
		    if("undefined"==typeof winHeight)winHeight="";
		    this.winHeight=winHeight;
		    if("undefined"==typeof winListurl)winListurl="";
		    this.winListurl=winListurl;
		    if("undefined"==typeof winFields)winFields="";
		    this.winFields=winFields;
		    if("undefined"==typeof columnModel)columnModel="";
		    this.columnModel=columnModel;
		    if("undefined"==typeof inputFormId)inputFormId="";
		    this.inputFormId=inputFormId;
		    if("undefined"== typeof select) select=false;
		    this.select=select;
		}
		var a=this.initPanel(e);
	    var c=new Ext.Window({
	        id:this.winId,
	        title:this.winTitle,
	        iconCls : "menu-appuser",
	        width:this.winWidth,
	        minWidth:this.winWidth,
	        height:this.winHeight,
	        minHeight:this.winHeight,
	        layout:"fit",
	        border:false,
	        maximizable:true,
	        resizable:true,
	        modal:true,
	        items:[a],
	        buttonAlign:"center",
	        buttons:SingleGridEject.buttons()
	    });
	    return c;
	},
	initPanel:function(obj){
	    var k=new Ext.data.Store({
	    proxy:new  Ext.data.HttpProxy({
	        url:this.winListurl,
	    }),
	    reader:new Ext.data.JsonReader({
	        root:"result",
	        totalProperty:"totalCounts",
	        id:"id",
	        fields:this.winFields,
	    }),
	    remoteSort:true
	    });
	    k.setDefaultSort("id","desc");
	    k.load({
	        params:{
	            start:0,
	            limit:12
	        }
	    });
	    var e=null;
	    e=new Ext.grid.CheckboxSelectionModel({
	        singleSelect:true
	    });
	    var columnsModel=[];
	    columnsModel.push(e);
	    columnsModel.push(new Ext.grid.RowNumberer());
	    if (this.columnModel.length > 0) {
	        for (var i = 0; i < this.columnModel.length; i++) {
	            columnsModel.push(this.columnModel[i]);
	        }
	    }
	    var l=new Ext.grid.ColumnModel({
	        columns:columnsModel,
            defaults:{
                sortable:true,
                menuDisabled:true,
                width:120
            }
	    });
	    var m=new Ext.grid.EditorGridPanel({
	        title:"修订",
	        autoScroll:true,
	        id:"singleGridPanel",
	        region:"center",
	        height:380,
	        autoWidth:false,
	        store:k,
	        shim:true,
	        trackMouseOver:true,
	        disableSelection:false,
	        loadMask:true,
	        cm:l,
	        sm:e,
	        scope:this,
	        viewConfig:{
	            forceFit:true,
	            enableRowBody:false,
	            showPreview:false
	        },
	        bbar:new HT.PagingBar({
	            store:k,
	            pageSize:15
	        })
	    });
	    m.on("rowdblclick",function(grid, rowIndex, e){
	        var records=grid.getSelectionModel().getSelections();
	        if(records.length==0){
	            Ext.MessageBox.show({
	                title:'系统提示',
	                msg:'请选择列表中信息！',
	                icon:Ext.MessageBox.INFO,
	                buttons:Ext.Msg.Ok
	                
	            })
	            return;
	        }else if(!obj.multiSel){
	            if(records.length>1){
	                Ext.MessageBox.show({
	                    title:'系统提示',
	                    msg:'只能选择一条信息！',
	                    icon:Ext.MessageBox.INFO,
	                    buttons:Ext.Msg.OK
	                })
	                return;
	            }
	        }
	        if(this.scope.select){
	            if(obj.callback){
	                obj.callback(records);
	             }
	            Ext.getCmp(this.scope.winId).close();
	        }else{
	            var config={
	                    id: records[0].data.id,
	                    operation : Constant.Operation.VIEW,
	                    isShow : true,
	                    years:records[0].data.years
	                    };
	            var str = "new " + this.scope.inputFormId + "(" + JSON.stringify(config) + ")";
	            eval(str).show();
	        }
	    });
	    return m;
	},
	close:function(){
	    Ext.getCmp(this.winId).close();
	},
	buttons:function(a){
	   var buttonItems=[];
	   buttonItems.push({
	       text:"关闭",
	       iconCls:"btn-cancel",
	       scope:this,
	       handler:this.close
	   });
	    return buttonItems;
	}
	
};